package com.smedi.ismedi.cronjob.api.feign;

import com.smedi.ismedi.cronjob.api.dto.request.JobRunRequest;
import com.smedi.ismedi.cronjob.api.dto.response.JobRunResponse;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author u
 */
@FeignClient("cronjob")
@Api(tags = {"定时任务执行记录接口"})
@RequestMapping(value = "/api/v1/cronjob/internal/jobRun")
public interface RemoteJobRunFeignApi {
    /**
     * 更新一个jobRun的运行状态
     *
     * @param jobRunRequest
     * @return string
     */
    @RequestMapping(value = "/updateJobRun")
    @ApiOperation(httpMethod = "POST", value = "更新一个jobRun的运行状态")
    ResponseData<JobRunResponse> postUpdateJobRun(JobRunRequest jobRunRequest);

    /**
     * 获取一个jobRun的信息
     *
     * @param id
     * @return string string
     */
    @RequestMapping(value = "/getJobRun")
    @ApiOperation(httpMethod = "POST", value = "获取一个jobRun的信息")
    ResponseData<JobRunResponse> postGetJobRun(Long id);

    /**
     * 获取所有jobRun的信息
     *
     * @param jobRunRequest
     * @return string
     */
    @RequestMapping(value = "/listJobRun")
    @ApiOperation(httpMethod = "POST", value = "获取所有jobRun的信息")
    ResponseData<List<JobRunResponse>> postListJobRun(JobRunRequest jobRunRequest);
}
